package com.yikome.order.repository;

import java.util.List;

import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import org.springframework.stereotype.Repository;

import com.yikome.common.CommonRepository;
import com.yikome.order.entity.OrderProduct;

@Repository
public interface OrderProductRepository extends CommonRepository<OrderProduct, Long> {

	@Query("select t from OrderProduct t where t.yn = 1 and t.id = :id")
	OrderProduct findOrderProduct(@Param("id")Long id);
	
	long deleteByOrderCode(String orderCode);

	@Query("select t from OrderProduct t where t.yn = 1 and t.orderCode = :orderCode")
	List<OrderProduct> findOrderProducts(@Param("orderCode")String orderCode);

}
